//获取所有地址
function addressListApi() {
    const Authorization = localStorage.getItem('Authorization')

    return $axios({
        'url': 'http://localhost:18080/address/addressBook/list',
        'method': 'get',
        headers: {
            'Authorization': `${Authorization}`
        },
    })
}

//获取最新地址
function addressLastUpdateApi() {
    const Authorization = localStorage.getItem('Authorization')

    return $axios({
        'url': 'http://localhost:18080/address/addressBook/lastUpdate',
        'method': 'get',
        headers: {
            'Authorization': `${Authorization}`
        },
    })
}

//新增地址
function addAddressApi(data) {
    const Authorization = localStorage.getItem('Authorization')
    return $axios({
        'url': 'http://localhost:18080/address/addressBook',
        'method': 'post',
        headers: {
            'Authorization': `${Authorization}`
        },
        data
    })
}

//修改地址
function updateAddressApi(data) {
    const Authorization = localStorage.getItem('Authorization')
    return $axios({
        'url': 'http://localhost:18080/address/addressBook',
        'method': 'put',
        headers: {
            'Authorization': `${Authorization}`
        },
        data
    })
}

//删除地址
function deleteAddressApi(params) {
    const Authorization = localStorage.getItem('Authorization')
    return $axios({
        'url': 'http://localhost:18080/address/addressBook',
        'method': 'delete',
        headers: {
            'Authorization': `${Authorization}`
        },
        params
    })
}

//查询单个地址
function addressFindOneApi(id) {
    return $axios({
        'url': `http://localhost:18080/address/addressBook/${id}`,
        'method': 'get',
    })
}

//设置默认地址
function setDefaultAddressApi(data) {
    const Authorization = localStorage.getItem('Authorization')
    return $axios({
        'url': 'http://localhost:18080/address/addressBook/default',
        'method': 'put',
        headers: {
            'Authorization': `${Authorization}`
        },
        data
    })
}

//获取默认地址
function getDefaultAddressApi() {
    const Authorization = localStorage.getItem('Authorization')

    return $axios({
        'url': `http://localhost:18080/address/addressBook/default`,
        'method': 'get',
        headers: {
            'Authorization': `${Authorization}`
        },
    })
}